package com.yang.myoschina.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.PagerAdapter;
import android.view.View;

import com.yang.myoschina.fragment.Myfragment;

/**
 * Created by yangjianquan on 2016/11/7.
 */

public class MyViewPagerAdapter extends FragmentPagerAdapter {

    public final int COUNT = 4;
    private String[] titles = new String[]{"新闻", "图片", "文字", "其他"};

    public MyViewPagerAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public int getCount() {
        return 4;
    }

    @Override
    public Fragment getItem(int position) {
        return Myfragment.newInstance(position + 1);
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }
}
